// 设备档案 模块

import { SystemSpace } from "@/api/interface/order"
import { ResPage } from "@/api/interface/index"
import http from "@/api"

// ------------------生产设备------------------ //
// 生产设备 分页查询
export const orderPage = (params: SystemSpace.orderPageQuery) => {
  return http.post<ResPage<SystemSpace.orderPage>>("/order/page", params)
}
// 根据生产设备 查询生产订单日产集合
export const dailyList = (id: number) => {
  return http.get<SystemSpace.dailyList[]>(`/order/daily/list?orderId=${id}`)
}
// 根据日产数据 查询清机记录集合
export const cleanList = (id: number) => {
  return http.get<SystemSpace.cleanList[]>(`/line/clean/list?dailyId=${id}`)
}
// 修改日产数据
export const modify = (params: { id: number; prodCnt: number }) => {
  return http.post<{ id: number; prodCnt: number }>("/order/daily/modify", params)
}
// 批量导入生产订单
export const importOrderPlan = (formData: FormData) => {
  return http.post<any>("/order/import", formData)
}
// 批量导入日产数据
export const importDailyData = (formData: FormData) => {
  return http.post<any>("/order/daily/import", formData)
}
// 批量保存清机记录
export const saveCleanRecords = (params: {
  dailyId: number
  cleanList: Array<{
    id?: number
    cleanLevel: string
    cleanCnt: number
    cleanTimes: number
    personCharge: string
  }>
}) => {
  return http.post<{ code: string; message?: string }>("/line/clean/save", params)
}
